package com.infocollect.project.api.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.infocollect.project.api.entity.TappProcessTypeEntity;
import com.infocollect.project.api.mapper.TappProcessTypeMapper;
import com.infocollect.project.api.service.ITappProcesstypeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (TappProcesstype)表服务实现类
 *
 * @author makejava
 * @since 2019-12-25 10:32:31
 */
@Service("tappProcesstypeService")
public class TappProcessTypeServiceImpl extends ServiceImpl<TappProcessTypeMapper, TappProcessTypeEntity> implements ITappProcesstypeService {


    /**
     * 通过ID查询单条数据
     *
     * @param fid 主键
     * @return 实例对象
     */
    @Override
    public TappProcessTypeEntity queryById(Long fid) {
        return this.baseMapper.queryById(fid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<TappProcessTypeEntity> queryAllByLimit(int offset, int limit) {
        return this.baseMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param tappProcesstype 实例对象
     * @return 实例对象
     */
    @Override
    public TappProcessTypeEntity insert(TappProcessTypeEntity tappProcesstype) {
        this.baseMapper.insert(tappProcesstype);
        return tappProcesstype;
    }

    /**
     * 修改数据
     *
     * @param tappProcesstype 实例对象
     * @return 实例对象
     */
    @Override
    public TappProcessTypeEntity update(TappProcessTypeEntity tappProcesstype) {
        this.baseMapper.updateById(tappProcesstype);
        return this.queryById(tappProcesstype.getFid());
    }

    /**
     * 通过主键删除数据
     *
     * @param fid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long fid) {
        return this.baseMapper.deleteById(fid) > 0;
    }

    /**
     * 查询多条数据
     * @menu 根据实体对象是否有值 进行查询
     * @return 对象列表
     */
    @Override
    public List<TappProcessTypeEntity> queryAll(TappProcessTypeEntity entity){
        return this.baseMapper.queryAll(entity) ;
    }
}